AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")
include('shared.lua')

function ENT:ShowOutput()
	self:SetOverlayText( "You orbit this, k?\nRadius:" .. self.Entity.rad .. "\nAffect Radius: " .. self.Entity.erad .. "\nStrength: " .. self.Entity.mul )
end

function ENT:SpawnFunction(ply, tr)
	if(!tr.Hit) then return end
	local ent = ents.Create("orbit")
	ent.OwnerM = ply
	ent:SetPos(tr.HitPos + (tr.HitNormal * 16))
	ent:Spawn()
	ent:Activate()
	return ent
end

function ENT:Initialize()
	self.Entity:SetModel("models/Combine_Helicopter/helicopter_bomb01.mdl")
	self.Entity:PhysicsInit(SOLID_VPHYSICS)
	self.Entity:SetMoveType(MOVETYPE_VPHYSICS)
	self.Entity:SetSolid(SOLID_VPHYSICS)
	self.Inputs = Wire_CreateInputs(self.Entity, { "Radius","Affect Radius", "Strength" })
	
	self.Entity:SetColor(0, 0, 0, 255)
	self.Entity:SetMaterial("models/shiny")
	--self:SetOverlayText("orly?"
	local Phys = self.Entity:GetPhysicsObject()
	if(Phys:IsValid()) then
		Phys:Wake()
	end
	self.Entity.rad = 0
	self.Entity.mul = 0.01
	self.Entity.erad = 3000
	self:ShowOutput()
end

function ENT:Think()
	return true
end

function ENT:TriggerInput(iname, value)
	if iname == "Radius" then
		self.Entity.rad = value
	elseif iname == "Strength" then
		self.Entity.mul = value
	elseif iname == "Affect Radius" then
		self.Entity.erad = value
	end
	self:ShowOutput()
end

function ENT:OnRemove()
	
end
